#pragma once


/*
* Escape sequences handling and common constants
*/

#include <string>
#include <iostream>


namespace bzbterm {

	
	// EscSeq is an helper class to handle escape sequences
	struct EscSeq {
		
		std::string str {""};

		// Initialize with given escaped string
		EscSeq(std::string s) : str(s) {}

		friend std::ostream& operator<<(std::ostream& stream, const EscSeq& e) {
			stream << e.str;
			return stream;
		}

	};


	namespace style {

		const EscSeq reset("\033[0m");
		const EscSeq bold("\033[1m");
		const EscSeq faint("\033[2m");
		const EscSeq italic("\033[3m");
		const EscSeq underline("\033[4m");
		const EscSeq overline("\033[53m");
		const EscSeq blink("\033[5m");
		const EscSeq blink_rapid("\033[6m");
		const EscSeq reverse("\033[7m");
		const EscSeq conceal("\033[8m");
		const EscSeq crossedout("\033[9m");

		const EscSeq defaultfont("\033[10m");
		const EscSeq altfont1("\033[11m");
		const EscSeq altfont2("\033[12m");
		const EscSeq altfont3("\033[13m");
		const EscSeq altfont4("\033[14m");
		const EscSeq altfont5("\033[15m");
		const EscSeq altfont6("\033[16m");
		const EscSeq altfont7("\033[17m");
		const EscSeq altfont8("\033[18m");
		const EscSeq altfont9("\033[19m");

		const EscSeq bold_off("\033[21m");
		const EscSeq normal("\033[22m");
		const EscSeq italic_off("\033[23m");
		const EscSeq underline_off("\033[24m");
		const EscSeq blink_off("\033[25m");
		const EscSeq inverse_off("\033[27m");
		const EscSeq conceal_off("\033[28m");
		const EscSeq crossedout_off("\033[29m");
		const EscSeq framed("\033[51m");
		const EscSeq encircled("\033[52m");
		const EscSeq overlined("\033[53m");
		const EscSeq framed_off("\033[54m");
		const EscSeq overlined_off("\033[55m");

	}


	namespace fg {

		const EscSeq bright_black("\033[90m");
		const EscSeq bright_red("\033[91m");
		const EscSeq bright_green("\033[92m");
		const EscSeq bright_yellow("\033[93m");
		const EscSeq bright_blue("\033[94m");
		const EscSeq bright_magenta("\033[95m");
		const EscSeq bright_cyan("\033[96m");
		const EscSeq bright_white("\033[97m");

		const EscSeq black("\033[30m");
		const EscSeq red("\033[31m");
		const EscSeq green("\033[32m");
		const EscSeq yellow("\033[33m");
		const EscSeq blue("\033[34m");
		const EscSeq magenta("\033[35m");
		const EscSeq cyan("\033[36m");
		const EscSeq white("\033[37m");

		const EscSeq reset("\033[39m");
	}


	namespace bg {

		const EscSeq bright_black("\033[100m");
		const EscSeq bright_red("\033[101m");
		const EscSeq bright_green("\033[102m");
		const EscSeq bright_yellow("\033[103m");
		const EscSeq bright_blue("\033[104m");
		const EscSeq bright_magenta("\033[105m");
		const EscSeq bright_cyan("\033[106m");
		const EscSeq bright_white("\033[107m");

		const EscSeq black("\033[40m");
		const EscSeq red("\033[41m");
		const EscSeq green("\033[42m");
		const EscSeq yellow("\033[43m");
		const EscSeq blue("\033[44m");
		const EscSeq magenta("\033[45m");
		const EscSeq cyan("\033[46m");
		const EscSeq white("\033[47m");

		const EscSeq reset("\033[49m");

	}

}
